const menuService = require("../services/menuService");
// 添加用户
exports.addMenu = (req, res) => {
  menuService.addMenu(req, res); // 添加用户
};

// 编辑用户
exports.editMenu = async (req, res) => {
  try {
    console.log(req.body);
    await menuService.checkMovedMenu(req);
    await menuService.editMenu(req, res);
  } catch (error) {
    res.tip(error);
  }
};

// 删除用户
exports.deleteMenu = async (req, res) => {
  try {
    await menuService.checkIsChild(req);
    await menuService.deleteMenu(req, res);
  } catch (error) {
    res.tip(error);
  }
};

// 获取用户列表
exports.getMenuTreeList = (req, res) => {
  menuService.getMenuTreeList(req, res);
};
